<template>
  <div>
    <el-container>
      <el-header>
        <div class="w-1200">
          <div class="logo">
            <el-image style="width: auto; height: 36px" :src="Logo"></el-image>
          </div>
        </div>
      </el-header>
      <el-main>
        <div class="w-1200 main">
          <router-view :key="key" />
        </div>
      </el-main>
      <el-footer>
        <div class="w-1200">
          <span @click="toBackend">Powered By Element-vue-template</span>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
  import Logo from "@/static/logo.png"
  export default {
    data() {
      return {
        Logo: Logo,
        clickTimes: 0,
      }
    },
    computed: {
      key() {
        return this.$route.path
      }
    },
    methods: {
      toBackend() {
        this.clickTimes += 1;
        if (this.clickTimes >= 5) {
          this.$router.push('/login');
          this.clickTimes = 0;
        }
      }
    }
  }
</script>

<style scoped lang="scss">
  .el-header {
    box-shadow: 0 1px 10px #eee;

    .logo {
      height: 60px;
      display: flex;
      align-items: center;
    }
  }

  .main {
    min-height: calc(100vh - 60px - 30px - 40px);
  }

  .el-footer {
    height: 30px !important;
    line-height: 30px;
    text-align: center;
    font-size: 12px;
    color: #ccc;
    user-select: none
  }

  .w-1200 {
    width: 1200px;
    margin: 0 auto;
  }
  @media print {
    .el-footer{
      display: none;
    }
  }
</style>
